import time

from xml.dom.minidom import parse
from xpinyin import Pinyin
#minidom解析器打开xml文档并将其解析为内存中的一棵树
from demo01.work09.py import YouDao
p = Pinyin()
DOMTree=parse(r'C:\Users\1\Desktop\FalloutNV_en_cn.xml')
DOMTree2=parse(r'C:\Users\1\Desktop\test02.xml')
#获取xml文档对象，就是拿到树的根
list = DOMTree.documentElement
list2 = DOMTree2.documentElement
#获取booklist对象中所有book节点的list集合
str = list.getElementsByTagName('String')
str2 = list2.getElementsByTagName('String')
for i in range(len(str)):
    childnode = str[i].getElementsByTagName('Dest')[0].childNodes[0]
    childnode2 = str2[i].getElementsByTagName('Dest')[0].childNodes[0]
    childnode.appendData('('+childnode2.data+')')

xml_path = r"C:\Users\1\Desktop\win3.xml"
fp = open(xml_path, 'w', encoding='utf-8')
DOMTree.writexml(fp, indent='', addindent='', newl='', encoding='utf-8')
fp.close()